package java2022_07_11;

import java.io.File;
import java.io.IOException;

public class FileDemo4 {
    public static void main(String[] args) throws IOException, InterruptedException {
        File file = new File("helloworld.txt");
        file.createNewFile();
        System.out.println("文件创建成功");
        Thread.sleep(3000);
        file.deleteOnExit();
        System.out.println("把文件标记为退出则删除状态");
        Thread.sleep(4000);
    }
}
